using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;
using DevExpress.Xpo;
namespace Ascent.QiPei.Module.BusinessObjects.Base
{
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("基础数据")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品")]
  [DevExpress.ExpressApp.DC.XafDefaultPropertyAttribute("ProductName")]
  public partial class Product : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.String _producingArea;
    private System.String _brand;
    private System.String _productCodeAlias;
    private System.DateTime _lastNegativeStocksDate;
    private Ascent.QiPei.Module.BusinessObjects.Sales.QuotationItems _quotationItems;
    private System.DateTime _lastNegativeDate;
    private System.Single _directImportPrices;
    private Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryVerificationItems _inventoryVerificationItems;
    private Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryAdjustmentItems _inventoryAdjustmentItems;
    private Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryTransferItems _inventoryTransferItems;
    private Ascent.QiPei.Module.BusinessObjects.Sales.CustomerReturnItems _customerReturnItems;
    private Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingReturnItems _purchasingReturnItems;
    private System.Int32 _wasteQuantity;
    private Ascent.QiPei.Module.BusinessObjects.Purchase.InquiryItems _inquiryItems;
    private System.Int32 _availableQuantity;
    private System.Int32 _safeStocks;
    private System.Int32 _maxStocks;
    private System.Single _retailPrice;
    private Ascent.QiPei.Module.BusinessObjects.Sales.SaleOrderItems _saleOrderItems;
    private DevExpress.Persistent.BaseImpl.FileData _attachment;
    private Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingOrderItems _purchasingOrderItems;
    private System.String _isActive;
    private System.String _remarks;
    private System.Single _preferentialPrice;
    private System.Single _lowestPrice;
    private System.Single _batchPrice;
    private Ascent.QiPei.Module.BusinessObjects.Base.Unit _unit;
    private Ascent.QiPei.Module.BusinessObjects.Base.ProductCategory _productCategory;
    private System.String _productDescription;
    private System.String _productSpecification;
    private System.String _productAlias;
    private System.String _productName;
    private System.String _productCode;
    public Product(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品编码")]
    [RuleRequiredField(DefaultContexts.Save)]
    public System.String ProductCode
    {
      get
      {
        return _productCode;
      }
      set
      {
        SetPropertyValue("ProductCode", ref _productCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品副编码")]
    public System.String ProductCodeAlias
    {
      get
      {
        return _productCodeAlias;
      }
      set
      {
        SetPropertyValue("ProductCodeAlias", ref _productCodeAlias, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品名称")]
    [RuleRequiredField(DefaultContexts.Save)]
    public System.String ProductName
    {
      get
      {
        return _productName;
      }
      set
      {
        SetPropertyValue("ProductName", ref _productName, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品别名")]
    public System.String ProductAlias
    {
      get
      {
        return _productAlias;
      }
      set
      {
        SetPropertyValue("ProductAlias", ref _productAlias, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品品牌")]
    public System.String Brand
    {
      get
      {
        return _brand;
      }
      set
      {
        SetPropertyValue("Brand", ref _brand, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产地")]
    public System.String ProducingArea
    {
      get
      {
        return _producingArea;
      }
      set
      {
        SetPropertyValue("ProducingArea", ref _producingArea, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品车型")]
    public System.String ProductSpecification
    {
      get
      {
        return _productSpecification;
      }
      set
      {
        SetPropertyValue("ProductSpecification", ref _productSpecification, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品描述")]
    public System.String ProductDescription
    {
      get
      {
        return _productDescription;
      }
      set
      {
        SetPropertyValue("ProductDescription", ref _productDescription, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品类")]
    public Ascent.QiPei.Module.BusinessObjects.Base.ProductCategory ProductCategory
    {
      get
      {
        return _productCategory;
      }
      set
      {
        SetPropertyValue("ProductCategory", ref _productCategory, value);
        //if (_productCategory == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.ProductCategory prevProductCategory = _productCategory;
        //_productCategory = value;
        //if (IsLoading)
        //  return;
        //if (prevProductCategory != null && prevProductCategory.Product == this)
        //  prevProductCategory.Product = null;
        //if (_productCategory != null)
        //  _productCategory.Product = this;
        //OnChanged("ProductCategory");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("单位")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Unit Unit
    {
      get
      {
        return _unit;
      }
      set
      {
        SetPropertyValue("Unit", ref _unit, value);
        //if (_unit == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Unit prevUnit = _unit;
        //_unit = value;
        //if (IsLoading)
        //  return;
        //if (prevUnit != null && prevUnit.Product == this)
        //  prevUnit.Product = null;
        //if (_unit != null)
        //  _unit.Product = this;
        //OnChanged("Unit");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("安全库存")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Int32 SafeStocks
    {
      get
      {
        return _safeStocks;
      }
      set
      {
        SetPropertyValue("SafeStocks", ref _safeStocks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("最高库存")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Int32 MaxStocks
    {
      get
      {
        return _maxStocks;
      }
      set
      {
        SetPropertyValue("MaxStocks", ref _maxStocks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("进货价")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Single DirectImportPrices
    {
      get
      {
        return _directImportPrices;
      }
      set
      {
        SetPropertyValue("DirectImportPrices", ref _directImportPrices, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("批发价")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.Single BatchPrice
    {
      get
      {
        return _batchPrice;
      }
      set
      {
        SetPropertyValue("BatchPrice", ref _batchPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("零售价")]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.Single RetailPrice
    {
      get
      {
        return _retailPrice;
      }
      set
      {
        SetPropertyValue("RetailPrice", ref _retailPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("最低价")]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.Single LowestPrice
    {
      get
      {
        return _lowestPrice;
      }
      set
      {
        SetPropertyValue("LowestPrice", ref _lowestPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("优惠价")]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    public System.Single PreferentialPrice
    {
      get
      {
        return _preferentialPrice;
      }
      set
      {
        SetPropertyValue("PreferentialPrice", ref _preferentialPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("可用库存")]
    public System.Int32 AvailableQuantity
    {
      get
      {
        return _availableQuantity;
      }
      set
      {
        SetPropertyValue("AvailableQuantity", ref _availableQuantity, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("废品库存")]
    public System.Int32 WasteQuantity
    {
      get
      {
        return _wasteQuantity;
      }
      set
      {
        SetPropertyValue("WasteQuantity", ref _wasteQuantity, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remarks
    {
      get
      {
        return _remarks;
      }
      set
      {
        SetPropertyValue("Remarks", ref _remarks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("是否可用")]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public System.String IsActive
    {
      get
      {
        return _isActive;
      }
      set
      {
        SetPropertyValue("IsActive", ref _isActive, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("附件")]
    [DevExpress.Xpo.AggregatedAttribute]
    [DevExpress.Persistent.Base.ExpandObjectMembersAttribute(ExpandObjectMembers.Never)]
    [DevExpress.Persistent.Base.VisibleInLookupListViewAttribute(false)]
    [DevExpress.Persistent.Base.VisibleInListViewAttribute(false)]
    public DevExpress.Persistent.BaseImpl.FileData Attachment
    {
      get
      {
        return _attachment;
      }
      set
      {
        SetPropertyValue("Attachment", ref _attachment, value);
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingOrderItems PurchasingOrderItems
    {
      get
      {
        return _purchasingOrderItems;
      }
      set
      {
        if (_purchasingOrderItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingOrderItems prevPurchasingOrderItems = _purchasingOrderItems;
        _purchasingOrderItems = value;
        if (IsLoading)
          return;
        if (prevPurchasingOrderItems != null && prevPurchasingOrderItems.Product == this)
          prevPurchasingOrderItems.Product = null;
        if (_purchasingOrderItems != null)
          _purchasingOrderItems.Product = this;
        OnChanged("PurchasingOrderItems");
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Sales.SaleOrderItems SaleOrderItems
    {
      get
      {
        return _saleOrderItems;
      }
      set
      {
        if (_saleOrderItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Sales.SaleOrderItems prevSaleOrderItems = _saleOrderItems;
        _saleOrderItems = value;
        if (IsLoading)
          return;
        if (prevSaleOrderItems != null && prevSaleOrderItems.Product == this)
          prevSaleOrderItems.Product = null;
        if (_saleOrderItems != null)
          _saleOrderItems.Product = this;
        OnChanged("SaleOrderItems");
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Purchase.InquiryItems InquiryItems
    {
      get
      {
        return _inquiryItems;
      }
      set
      {
        if (_inquiryItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Purchase.InquiryItems prevInquiryItems = _inquiryItems;
        _inquiryItems = value;
        if (IsLoading)
          return;
        if (prevInquiryItems != null && prevInquiryItems.Product == this)
          prevInquiryItems.Product = null;
        if (_inquiryItems != null)
          _inquiryItems.Product = this;
        OnChanged("InquiryItems");
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingReturnItems PurchasingReturnItems
    {
      get
      {
        return _purchasingReturnItems;
      }
      set
      {
        if (_purchasingReturnItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingReturnItems prevPurchasingReturnItems = _purchasingReturnItems;
        _purchasingReturnItems = value;
        if (IsLoading)
          return;
        if (prevPurchasingReturnItems != null && prevPurchasingReturnItems.Product == this)
          prevPurchasingReturnItems.Product = null;
        if (_purchasingReturnItems != null)
          _purchasingReturnItems.Product = this;
        OnChanged("PurchasingReturnItems");
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Sales.CustomerReturnItems CustomerReturnItems
    {
      get
      {
        return _customerReturnItems;
      }
      set
      {
        if (_customerReturnItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Sales.CustomerReturnItems prevCustomerReturnItems = _customerReturnItems;
        _customerReturnItems = value;
        if (IsLoading)
          return;
        if (prevCustomerReturnItems != null && prevCustomerReturnItems.Product == this)
          prevCustomerReturnItems.Product = null;
        if (_customerReturnItems != null)
          _customerReturnItems.Product = this;
        OnChanged("CustomerReturnItems");
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryTransferItems InventoryTransferItems
    {
      get
      {
        return _inventoryTransferItems;
      }
      set
      {
        if (_inventoryTransferItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryTransferItems prevInventoryTransferItems = _inventoryTransferItems;
        _inventoryTransferItems = value;
        if (IsLoading)
          return;
        if (prevInventoryTransferItems != null && prevInventoryTransferItems.Product == this)
          prevInventoryTransferItems.Product = null;
        if (_inventoryTransferItems != null)
          _inventoryTransferItems.Product = this;
        OnChanged("InventoryTransferItems");
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryAdjustmentItems InventoryAdjustmentItems
    {
      get
      {
        return _inventoryAdjustmentItems;
      }
      set
      {
        if (_inventoryAdjustmentItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryAdjustmentItems prevInventoryAdjustmentItems = _inventoryAdjustmentItems;
        _inventoryAdjustmentItems = value;
        if (IsLoading)
          return;
        if (prevInventoryAdjustmentItems != null && prevInventoryAdjustmentItems.Product == this)
          prevInventoryAdjustmentItems.Product = null;
        if (_inventoryAdjustmentItems != null)
          _inventoryAdjustmentItems.Product = this;
        OnChanged("InventoryAdjustmentItems");
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryVerificationItems InventoryVerificationItems
    {
      get
      {
        return _inventoryVerificationItems;
      }
      set
      {
        if (_inventoryVerificationItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Inventory.InventoryVerificationItems prevInventoryVerificationItems = _inventoryVerificationItems;
        _inventoryVerificationItems = value;
        if (IsLoading)
          return;
        if (prevInventoryVerificationItems != null && prevInventoryVerificationItems.Product == this)
          prevInventoryVerificationItems.Product = null;
        if (_inventoryVerificationItems != null)
          _inventoryVerificationItems.Product = this;
        OnChanged("InventoryVerificationItems");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("最近负库存时间")]
    [System.ComponentModel.BrowsableAttribute(false)]
    public System.DateTime LastNegativeDate
    {
      get
      {
        return _lastNegativeDate;
      }
      set
      {
        SetPropertyValue("LastNegativeDate", ref _lastNegativeDate, value);
      }
    }
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Sales.QuotationItems QuotationItems
    {
      get
      {
        return _quotationItems;
      }
      set
      {
        if (_quotationItems == value)
          return;
        Ascent.QiPei.Module.BusinessObjects.Sales.QuotationItems prevQuotationItems = _quotationItems;
        _quotationItems = value;
        if (IsLoading)
          return;
        if (prevQuotationItems != null && prevQuotationItems.Product == this)
          prevQuotationItems.Product = null;
        if (_quotationItems != null)
          _quotationItems.Product = this;
        OnChanged("QuotationItems");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("负库存日期")]
    [System.ComponentModel.BrowsableAttribute(false)]
    public System.DateTime LastNegativeStocksDate
    {
      get
      {
        return _lastNegativeStocksDate;
      }
      set
      {
        SetPropertyValue("LastNegativeStocksDate", ref _lastNegativeStocksDate, value);
      }
    }
  }
}
